package com.mgkj.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
 * @author : ssy
 * @date: 2024-04-26
 * @Description:
 */
@Mapper
public interface CommonMapper {
    @Select("${sql}")
    String getIdByType(String string);


    @Select("Select MF004 FROM ADMMF where MF001 = #{creator}")
    String getUsrGroup(@Param("creator") String creator);

    @DS("demo")
    @Select("SELECT MAX(${last}) FROM ${database} WHERE ${last} BETWEEN CONVERT(VARCHAR(8), GETDATE(), 112)+'001' AND CONVERT(VARCHAR(8), GETDATE(), 112)+'999'")
    Long getDH(@Param("database") String database, @Param("last") String last);

    @DS("demo")
    @Select("SELECT TOP 1 ML001 FROM CMSML")
    String getCompany();

    @DS("demo")
    @Select("SELECT count(*) FROM INVMB WHERE MB001 = #{th004} AND MB022 NOT IN ('N')")
    int getBooleanBatch(String th004);
}
